package nl.saxion.dbi.api;

import java.util.List;

import nl.saxion.dbi.exception.DatabaseAlreadyExistsException;
import nl.saxion.dbi.exception.DatabaseDoesNotExistsException;
import nl.saxion.dbi.exception.FieldAllreadyExistsException;
import nl.saxion.dbi.exception.FieldNotFoundException;
import nl.saxion.dbi.exception.IntegrityConstraintViolationException;
import nl.saxion.dbi.exception.InvalidTypeException;
import nl.saxion.dbi.exception.KeyAllreadyExistsException;
import nl.saxion.dbi.exception.KeyNotFoundException;
import nl.saxion.dbi.exception.KeyPairNotAllowedException;
import nl.saxion.dbi.exception.TableAlreadyExistsException;
import nl.saxion.dbi.exception.TableNotFoundException;
import nl.saxion.dbi.model.Database;
import nl.saxion.dbi.model.Row;
import nl.saxion.dbi.model.Tabel;

public interface Rdbms
{

	void createDatabase(String naam) throws DatabaseAlreadyExistsException;

	void deleteDatabase(String naam) throws IntegrityConstraintViolationException;

	List<Database> showDatabases();

	void createTabel(String database, String naam) throws TableAlreadyExistsException, DatabaseDoesNotExistsException;

	void deleteTabel(String database, String naam) throws IntegrityConstraintViolationException,
		DatabaseDoesNotExistsException;

	Database showDatabase(String database);

	void addVeld(String databsae, String tabel, String naam, String type, boolean notNull)
		throws FieldAllreadyExistsException, InvalidTypeException, DatabaseDoesNotExistsException;

	void deleteVeld(String database, String tabel, String naam) throws IntegrityConstraintViolationException,
		DatabaseDoesNotExistsException;

	void createKey(String database, String tabel, String naam, boolean isUnique, String... veldnaam)
		throws KeyAllreadyExistsException, FieldNotFoundException, DatabaseDoesNotExistsException;

	void addPrimaryKey(String database, String tabel, String keyNaam) throws KeyNotFoundException,
		TableNotFoundException, DatabaseDoesNotExistsException;

	void addForeignKey(String database, String fromKey, String toKey) throws KeyNotFoundException,
		KeyPairNotAllowedException, DatabaseDoesNotExistsException;

	void deleteKey(String database, String tabel, String keyNaam) throws IntegrityConstraintViolationException,
		DatabaseDoesNotExistsException;

	void insertInto(String databsae, String tabel, String[] data) throws IntegrityConstraintViolationException,
		DatabaseDoesNotExistsException;

	Tabel selectFrom(String database, String tabel) throws DatabaseDoesNotExistsException;

	List<Row> selectWhere(String database, String tabel, String veld, String value)
		throws DatabaseDoesNotExistsException;

	void deleteData(String database, String tabel) throws IntegrityConstraintViolationException,
		DatabaseDoesNotExistsException;

	void deleteDataWhere(String databse, String tabel, String veld, String value)
		throws DatabaseDoesNotExistsException, IntegrityConstraintViolationException;

	void clean();
}
